package com.qall.configability.prop;


import java.util.Map;
import java.util.Properties;


public class RemoteProperties {
    private Map<String, Object> propData = null;

    private Properties properties = new Properties();

    /**
     * data
     *
     * @param data 格式为 key = value\nkey = value
     */
    public RemoteProperties(Map<String, Object> data) {
        propData = data;
        loadProperty();
    }

    public Properties getProperties() {
        return properties;
    }

    public Map<String, Object> getPropData() {
        return propData;
    }

    public void setPropData(Map<String, Object> propData) {
        this.propData = propData;
    }

    public RemoteProperties addProp(String key, Object value) {
        properties.put(key, value);
        return this;
    }

    private void loadProperty() {

        for (Map.Entry<String, Object> entry : propData.entrySet()) {
            properties.put(entry.getKey(), entry.getValue());
        }
    }

}
